package com.ogilvy.audi.model;

import org.apache.struts2.json.annotations.JSON;
import org.hibernate.annotations.BatchSize;
import org.hibernate.annotations.ForeignKey;

import javax.persistence.*;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

/**
 * TblCircleTopic entity. @author MyEclipse Persistence Tools
 */
@Entity
   @Table(name="TBL_CIRCLE_TOPIC")
   @org.hibernate.annotations.Table(appliesTo = "TBL_CIRCLE_TOPIC", comment = " 圈子话题表 ")
public class CircleTopic implements java.io.Serializable {

	// Fields

	private Long topicId;
	private String tacticTitle;
	private String topicType;
	private String topicDesc;
	private Long userId;
	private String userName;
	private Date crDate;
	private Long isApprove;
	private Long cmntNum;
	private Long favoritesNum;
	private Long pointNum;
	private Long circleId;
	private Long isHot;
	private String urlAddress;
    private Integer version;
  /*  private CircleCategory circleCategory;
    private Set<CircleTcmnt> circleTcmnts=new HashSet<CircleTcmnt>();
*/	// Constructors

	/** default constructor */
	public CircleTopic() {
	}

	/** full constructor */
	public CircleTopic(String tacticTitle, String topicType,
                       String topicDesc, Long userId, String userName,
                       Long isApprove, Long cmntNum, Long favoritesNum, Long pointNum,
                    Long isHot, String urlAddress) {
		this.tacticTitle = tacticTitle;
		this.topicType = topicType;
		this.topicDesc = topicDesc;
		this.userId = userId;
		this.userName = userName;

		this.isApprove = isApprove;
		this.cmntNum = cmntNum;
		this.favoritesNum = favoritesNum;
		this.pointNum = pointNum;
		this.circleId = circleId;
		this.isHot = isHot;
		this.urlAddress = urlAddress;
	}

	// Property accessors
       @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
	public Long getTopicId() {
		return this.topicId;
	}

	public void setTopicId(Long topicId) {
		this.topicId = topicId;
	}
  @Column(length = 200)
	public String getTacticTitle() {
		return this.tacticTitle;
	}

	public void setTacticTitle(String tacticTitle) {
		this.tacticTitle = tacticTitle;
	}
 @Column(length = 200)
	public String getTopicType() {
		return this.topicType;
	}

	public void setTopicType(String topicType) {
		this.topicType = topicType;
	}
   @Column(length = 200)
	public String getTopicDesc() {
		return this.topicDesc;
	}

	public void setTopicDesc(String topicDesc) {
		this.topicDesc = topicDesc;
	}
 @Column(length = 100)
	public Long getUserId() {
		return this.userId;
	}

	public void setUserId(Long userId) {
		this.userId = userId;
	}
 @Column(length = 200)
	public String getUserName() {
		return this.userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}
    @Column(length =8)
	@Temporal(value= TemporalType.TIMESTAMP)
    public Date getCrDate() {
        return crDate;
    }

    public void setCrDate(Date crDate) {
        this.crDate = crDate;
    }
 @Column(length = 200)
    public Long getIsApprove() {
		return this.isApprove;
	}

	public void setIsApprove(Long isApprove) {
		this.isApprove = isApprove;
	}
 @Column(length = 200)
	public Long getCmntNum() {
		return this.cmntNum;
	}

	public void setCmntNum(Long cmntNum) {
		this.cmntNum = cmntNum;
	}
  @Column(length = 200)
	public Long getFavoritesNum() {
		return this.favoritesNum;
	}

	public void setFavoritesNum(Long favoritesNum) {
		this.favoritesNum = favoritesNum;
	}
   @Column(length = 200)
	public Long getPointNum() {
		return this.pointNum;
	}

	public void setPointNum(Long pointNum) {
		this.pointNum = pointNum;
	}

   @Column(length = 200)
	public Long getIsHot() {
		return this.isHot;
	}

	public void setIsHot(Long isHot) {
		this.isHot = isHot;
	}
  @Column(length = 200)
	public String getUrlAddress() {
		return this.urlAddress;
	}

	public void setUrlAddress(String urlAddress) {
		this.urlAddress = urlAddress;
	}
      @Version
    public Integer getVersion() {
        return version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }
    
    /*@OneToMany(mappedBy = "circleTopic", fetch = FetchType.LAZY)
   // @OrderBy("chapterNum")
    @BatchSize(size=50)
    public Set<CircleTcmnt> getCircleTcmnts() {
        return circleTcmnts;
    }

    public void setCircleTcmnts(Set<CircleTcmnt> circleTcmnts) {
        this.circleTcmnts = circleTcmnts;
    }

    @ManyToOne(targetEntity= CircleCategory.class,fetch = FetchType.LAZY,cascade={CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH})
    @JoinColumn(name="CIRCLE_ID",nullable=true)
    @ForeignKey(name="FK_TOPIC_CIRCLE_ID")
    @JSON(serialize=false)
    public CircleCategory getCircleCategory() {
        return circleCategory;
    }

    public void setCircleCategory(CircleCategory circleCategory) {
        this.circleCategory = circleCategory;
    }*/
}